'use strict';



/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
    const { router, controller } = app;
    router.get('/', controller.home.index);
    //获取验证码
    router.post('/user/getCode', controller.api.user.getCode);
    //用户注册
    router.post('/user/reg', controller.api.user.reg);
    //用户登录
    router.post('/user/login', controller.api.user.login);
    //用户首页
    router.get('/config', controller.api.config.configList);
    //用户测评页
    router.get('/config/appraisalConfig', controller.api.config.appraisalConfig);
    //用户测评列表
    router.get('/config/appraisalTypeList', controller.api.config.appraisalTypeList);
    //用户测评测评详情
    router.get('/config/appraisal/:id', controller.api.config.appraisalDetail);

    //用户课程页
    router.get('/config/courseConfig', controller.api.config.courseConfig);
    //用户课程列表
    router.get('/config/courseTypeList', controller.api.config.courseTypeList);
    //用户课程详情
    router.get('/config/course/:id', controller.api.config.courseDetail);

    // 咨询列表
    router.get('/config/consultationList', controller.api.config.consultationList);
    router.get('/config/consultationTypeList', controller.api.config.consultationTypeList);
    router.get('/config/consultationTypeList/:id', controller.api.config.consultationDetail);

    // 咨询列表
    router.get('/config/counselorList', controller.api.config.counselorList);
    router.get('/config/counselorListTypeList', controller.api.config.counselorListTypeList);
    router.get('/config/counselor/:id', controller.api.config.counselorDetail);
    // 测评题目列表
    router.get('/config/topicList', controller.api.config.topicList);

    router.get('/config/search', controller.api.config.search);
    // router.get('/config/consulTypeList', controller.api.config.consulTypeList);


    //user

    //用户收藏列表
    router.get('/user/usercollect', controller.api.user.usercollectList);
    //用户添加收藏
    router.get('/user/addUsercollect/:courseid', controller.api.user.addUsercollect);
    //我的订单
    router.get('/user/orderList', controller.api.user.orderList);
    //我的课程列表
    router.get('/user/courseList', controller.api.user.courseList);
    //我的测评列表
    router.get('/user/appraisalList', controller.api.user.appraisalList);
    //使用测评
    router.post('/user/useappraisal', controller.api.user.useappraisal);
    //我的课程视频列表
    router.get('/user/coursevideoList', controller.api.user.coursevideoList);





    // 课程微信支付
    router.post('/user/course/wxpay', controller.api.user.coursewxpay);
    // 测评微信支付
    router.post('/user/appraisal/wxpay', controller.api.user.appraisalwxpay);
    // 微信支付回调
    router.post('/config/notify', app.middleware.tenpay('pay', app), controller.api.user.notify);


    //后台管理

    //管理员登录
    router.post('/m/adminUser/login', controller.m.admin.login);
    //管理员信息
    router.get('/m/adminUser/profile', controller.m.admin.profile);
    //管理员信息更新
    router.put('/m/adminUser/name', controller.m.admin.updateName);
    //管理员密码更新
    router.put('/m/adminUser/password', controller.m.admin.updatePassword);
    //用户查询列表
    router.get('/m/users', controller.m.users.list);
    //文件上传
    router.post('/m/upload', controller.m.common.upload);
    //文件上传
    router.post('/m/uploads', controller.m.common.uploads);
    //轮播图配置列表
    router.get('/m/swiper', controller.m.swiper.list);
    //新增轮播图
    router.post('/m/swiper', controller.m.swiper.addSwiper);
    //更新轮播图配置
    router.put('/m/swiper', controller.m.swiper.updateSwiper);
    //删除轮播图配置
    router.delete('/m/swiper', controller.m.swiper.deleteSwiper);
    //获取单个轮播图配置
    router.get('/m/swiper/:id', controller.m.swiper.detail);
    //课程配置列表
    router.get('/m/courses/list', controller.m.courses.list);
    //新增课程
    router.post('/m/courses', controller.m.courses.addCourses);
    //更新课程配置
    router.put('/m/courses', controller.m.courses.updateCourses);
    //删除课程配置
    router.delete('/m/courses', controller.m.courses.deleteCourses);
    //获取单个课程配置
    router.get('/m/courses/:id', controller.m.courses.detail);
    //课程视频列表
    router.get('/m/video/list', controller.m.video.list);
    //新增课程视频
    router.post('/m/video', controller.m.video.addVideo);
    //更新课程视频
    router.put('/m/video', controller.m.video.updateVideo);
    //删除课程视频
    router.delete('/m/video', controller.m.video.deleteVideo);
    //获取单个课程视频配置
    router.get('/m/video/:id', controller.m.video.detail);
    //测评配置列表
    router.get('/m/appraisal/list', controller.m.appraisal.list);
    //新增测评
    router.post('/m/appraisal', controller.m.appraisal.addAppraisal);
    //更新测评配置
    router.put('/m/appraisal', controller.m.appraisal.updateAppraisal);
    //删除测评配置
    router.delete('/m/appraisal', controller.m.appraisal.deleteAppraisal);
    //获取单个测评配置
    router.get('/m/appraisal/:id', controller.m.appraisal.detail);
    //测评题目列表
    router.get('/m/topic/list', controller.m.topic.list);
    //新增测评题目
    router.post('/m/topic', controller.m.topic.addTopic);
    //更新测评题目
    router.put('/m/topic', controller.m.topic.updateTopic);
    //删除测评题目
    router.delete('/m/topic', controller.m.topic.deleteTopic);
    //获取单个课测题目配置
    router.get('/m/topic/:id', controller.m.topic.detail);
    //测评配置列表
    router.get('/m/counselor/list', controller.m.counselor.list);
    //新增测评
    router.post('/m/counselor', controller.m.counselor.addCounselor);
    //更新测评配置
    router.put('/m/counselor', controller.m.counselor.updateCounselor);
    //删除测评配置
    router.delete('/m/counselor', controller.m.counselor.deleteCounselor);
    //获取单个测评配置
    router.get('/m/counselor/:id', controller.m.counselor.detail);

    router.get('/m/livesp/livespList', controller.m.livesp.livespList);
    router.post('/m/livesp', controller.m.livesp.addVideo);
    router.delete('/m/livesp', controller.m.livesp.deleteCourses);
    router.get('/m/livesp/:id', controller.m.livesp.detail);
    router.put('/m/livesp', controller.m.livesp.updateVideo);
    // router.post('/m/livesp/addVideo', controller.m.livesp.addVideo);

    router.get('/m/consultation/consultationList', controller.m.consultation.consultationList);
    router.post('/m/consultation', controller.m.consultation.addconsultation);
    router.put('/m/consultation', controller.m.consultation.updateCourses);
    router.get('/m/consultation/:id', controller.m.consultation.detail);
    router.delete('/m/consultation', controller.m.consultation.deleteCourses);

    router.get('/config/h5pay', controller.api.config.h5pay);
    router.post('/h5paySubmit', controller.api.config.h5paySubmit);

};